﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace HotelManager
{
    public abstract class Room : IRentable
    {
        public int RoomNumber { get; set; }
        public bool IsOccupied { get; set; }
        public bool IsReserved { get; set; }
        public bool IsClean { get; set; }
        public decimal Cost { get; set; }
        public Minibar Minibar { get; set; }
        public DateTime RentDate { get; set; }
        public DateTime ReservationDate { get; set; }
        public Person CurrentGuest { get; set; }
        public Person FutureGuest { get; set; }
        public DateTime LeaveDate { get; set; }

        public Room()
        {

        }

        public void Rent(RentInfo rentInfo, Engine engine)
        {
            this.IsOccupied = true;
            this.RentDate = rentInfo.RentFrom;
            this.CurrentGuest = rentInfo.Guest;

            engine.RentHistory.Add(rentInfo);
        }

        public void Reserve(ReservationInfo reservationInfo, Engine engine)
        {
            this.IsReserved = true;
            this.ReservationDate = reservationInfo.TimeForCheckIn;
            this.FutureGuest = reservationInfo.Guest;

            engine.ReservationHistory.Add(reservationInfo);
        }

        public override string ToString()
        {
            return string.Format("Room {0}. Is free: {1}.", this.RoomNumber, !this.IsOccupied);
        }
    }
}
